<template>
	<view class="">
		<!-- 头部 -->
		<view class="header_bar header_fixed header_main">
			<view class="header">
				<view class="header-goBack" @click="$tools.back(1)"></view>
				<view class="header-title">公告</view>
			</view> 
		</view> 
		
		<view class="noticeBox">
			<view class="article">
				<view class="article-list" v-if="isShowPage">
					<view class="article-list__item" v-for="(item,index) in sysNoticeList" :key="index"
					v-if="sysNoticeList.length > 0"
					@tap.stop="$tools.jump('./information_details',item.noticeId)">
						<view class="top">
							<view class="content ">
								{{  item.noticeTitle }}
							</view>
						</view>
						<view class="bottom">
							<view class="left">
								<view class="box">
									<view class="txt">{{ item.createTime }}</view>
								</view>
							</view>
						</view>
					</view>
					<view class="initNoData" v-if="sysNoticeList.length == 0">啊哦！暂无消息~</view>
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		components:{
		},
		data(){
			return{
				sysNoticeList: [],
				type: '',
				isShowPage: false,
				pageIndex: 1,
				pageSize: 10,
			}
		},
		onLoad() {
		},
		onShow() {
			this.init();
		},
		onReachBottom() {
			console.log("onReachBottom",this.lsShow);
			if (this.pageIndex >= this.pages) {
				return this.$tools.toast('到底了');
			} else {
				this.pageIndex++;
				console.log("+++")
				this.getSysNoticeList();
			}
		},
		methods: {
			init() {
				this.pages = 1;
				this.pageIndex = 1;
				this.pageSize = 10;
				this.sysNoticeList = [];
				this.isShowPage = false;
				this.getSysNoticeList();
			},
			getSysNoticeList() {
				var data = {};
				data['pageIndex'] = this.pageIndex;
				data['pageSize'] = this.pageSize;
				console.log("data：",data);
				this.$Ajax('/api/notice/getSysNoticeList',data,res => {
						if (res.code == 200) {
							this.isShowPage = true;
							this.pages = res.data.pages;
							this.sysNoticeList = this.sysNoticeList.concat(res.data.list);
						}
					}, err =>{
					}, 'GET' , false
				)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.noticeBox{
		margin: 32rpx 0 0;
	}
	
</style>